package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppFansClubDao;
import com.vf.admin.client.service.AppFansClubService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppFansClub;
import com.vf.admin.miaodong.entity.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 粉丝团
 */
@Service
public class AppFansClubServiceImpl implements AppFansClubService {

    @Autowired
    AppFansClubDao appFansClubDao;

    @Override
    public List<AppFansClub> fanlituanList() {
        return appFansClubDao.fanlituanList();
    }

    @Override
    public List<AppFansClub> roomList(Integer roomid,SplitPageBean splitPageBean) {
        return appFansClubDao.roomList(roomid,splitPageBean);
    }

    @Override
    public AppFansClub get(Integer id) {
        return appFansClubDao.get(id);
    }

    @Override
    public AppFansClub getFensiTuan(Integer userid,Integer roomcode) {
        return appFansClubDao.getFensiTuan(userid,roomcode);
    }

    @Override
    public void save(AppFansClub haoYou) {
        appFansClubDao.save(haoYou);
    }

    @Override
    public void fensiSave(Integer roomcode, Integer roomid, AppUser user) {
        AppFansClub appFansClub = new AppFansClub();
        appFansClub.setUserid(user.getId());
        appFansClub.setRoomcode(roomcode);
        appFansClub.setCreatetime(new Date());
        appFansClub.setRoomid(roomid);
        appFansClub.setNick(user.getNick());
        appFansClub.setPic(user.getPic());
        appFansClub.setPhone(user.getLoginname());
        appFansClub.setGrade(1);
        appFansClubDao.save(appFansClub);
    }

    @Override
    public void del(Integer id) {
        appFansClubDao.del(id);
    }
}
